package com.qf.service.Impl;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.qf.dao.UserAMapper;
import com.qf.service.UserAService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

@Service
public class UserAServiceImpl implements UserAService {
    @Autowired
    private UserAMapper userAMapper;
    @Autowired
    private RestTemplate restTemplate;
    @Override
    @Transactional//此注解是本地事物的注解
    //@LcnTransaction
    public String desc() {
        //1.账户A扣款
        String s = String.valueOf(userAMapper.userAMapper());
        //2.账户B加款
        String forObject = restTemplate.getForObject("http://localhost:8082/userB/add", String.class);
        System.out.println("---------"+forObject);

        return "A ok!";
    }
}
